Interactive Visual Exploratory Data Analysis of Covid-19 in Indonesia


This Data Visualization repository is solely developed for the research article mentioned here. This is only for visualization purposes and all the visualization models made from the data sources provided by Indonesia's national disaster management agency. In Indonesia, it called Badan Nasional Penanggulangan Bencana (BNPB). Here we present an approach to visualize and analyze the data of daily statistical covid 19 dataset for each province in Indonesia from its API (access in : https://bnpb-inacovid19.hub.arcgis.com/datasets/statistik-harian-per-provinsi-covid19-indonesia-rev/geoservice)

Table of Content

  1. Import Library
  2. Data Wrangling
  3. Exploratory Data Analysis
  4. Interactive Visualization using Heat Maps
  5. Interactive Visualization using Bart Chart
  6. Interactive Visualization using Pie Chart
  7. Interactive Visualization using Bubble Chart
  8. Interactive Visualization using Tree Maps
  9. Interactive Visualization using Line Chart
  10. Interactive Visualization using Scatter Plot
  11. Simple Dashboard (Inspired by Bee Guan Teo)

Import Library

In [4]:
import plotly.express as px
from plotly.subplots import make_subplots
import plotly.graph_objs as go 

import pandas as pd
import requests
import json
from pandas.io.json import json_normalize

Data Wrangling

In [5]:
api_bnpb = "https://opendata.arcgis.com/datasets/685be21cd0034247b5ceeac996d947fe_0.geojson" #initialization of url json
request = requests.get(api_bnpb)
request
Out[5]:
<Response [200]>
In [6]:
data = request.json()
df = pd.json_normalize(data,'features', sep = "_")
df.head() #showing the content of the data 
Out[6]:
type geometry properties_Object_ID properties_Provinsi properties_Tanggal properties_Kasus_Terkonfirmasi_Akumulatif properties_Penambahan_Harian_Kasus_Terkonf properties_Kasus_Sembuh_Akumulatif properties_Penambahan_Harian_Kasus_Sembuh properties_Kasus_Meninggal_Akumulatif properties_Penambahan_Harian_Kasus_Meningg properties_Kasus_Aktif_Akumulatif properties_CFR_Harian properties_RI_Harian properties_FID properties_ObjectId
0 Feature None 1.0 Aceh 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0 #DIV/0! #DIV/0! 1.0 3572
1 Feature None 2.0 Bali 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0 #DIV/0! #DIV/0! 2.0 3573
2 Feature None 3.0 Banten 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0 #DIV/0! #DIV/0! 3.0 3574
3 Feature None 4.0 Kepulauan Bangka Belitung 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0 #DIV/0! #DIV/0! 4.0 3575
4 Feature None 5.0 Bengkulu 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0 #DIV/0! #DIV/0! 5.0 3576
In [7]:
df.tail()
Out[7]:
type geometry properties_Object_ID properties_Provinsi properties_Tanggal properties_Kasus_Terkonfirmasi_Akumulatif properties_Penambahan_Harian_Kasus_Terkonf properties_Kasus_Sembuh_Akumulatif properties_Penambahan_Harian_Kasus_Sembuh properties_Kasus_Meninggal_Akumulatif properties_Penambahan_Harian_Kasus_Meningg properties_Kasus_Aktif_Akumulatif properties_CFR_Harian properties_RI_Harian properties_FID properties_ObjectId
8448 Feature None 8449.0 Papua Barat 2020/11/07 00:00:00+00 4189.0 326.0 3655.0 389.0 66.0 19.0 468.0 1.5755550250656483 87.25232752446884 8449.0 12409
8449 Feature None 8450.0 Papua 2020/11/07 00:00:00+00 9037.0 4848.0 4637.0 982.0 129.0 63.0 4271.0 1.4274648666592897 51.311275865884696 8450.0 12410
8450 Feature None 8451.0 Sulawesi Barat 2020/11/07 00:00:00+00 1036.0 -8001.0 841.0 -3796.0 14.0 -115.0 181.0 1.3513513513513513 81.17760617760618 8451.0 12411
8451 Feature None 8452.0 Nusa Tenggara Timur 2020/11/07 00:00:00+00 694.0 -342.0 500.0 -341.0 7.0 -7.0 187.0 1.0086455331412103 72.04610951008645 8452.0 12412
8452 Feature None 8453.0 Gorontalo 2020/11/07 00:00:00+00 3021.0 2327.0 2859.0 2359.0 85.0 78.0 77.0 2.8136378682555447 94.63753723932473 8453.0 12413
In [8]:
#filtering column that you use
df.drop(columns = ['type', 'geometry','properties_Object_ID', 'properties_CFR_Harian','properties_RI_Harian','properties_FID','properties_ObjectId'], inplace = True)
df
Out[8]:
properties_Provinsi properties_Tanggal properties_Kasus_Terkonfirmasi_Akumulatif properties_Penambahan_Harian_Kasus_Terkonf properties_Kasus_Sembuh_Akumulatif properties_Penambahan_Harian_Kasus_Sembuh properties_Kasus_Meninggal_Akumulatif properties_Penambahan_Harian_Kasus_Meningg properties_Kasus_Aktif_Akumulatif
0 Aceh 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0
1 Bali 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0
2 Banten 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0
3 Kepulauan Bangka Belitung 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0
4 Bengkulu 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0
... ... ... ... ... ... ... ... ... ...
8448 Papua Barat 2020/11/07 00:00:00+00 4189.0 326.0 3655.0 389.0 66.0 19.0 468.0
8449 Papua 2020/11/07 00:00:00+00 9037.0 4848.0 4637.0 982.0 129.0 63.0 4271.0
8450 Sulawesi Barat 2020/11/07 00:00:00+00 1036.0 -8001.0 841.0 -3796.0 14.0 -115.0 181.0
8451 Nusa Tenggara Timur 2020/11/07 00:00:00+00 694.0 -342.0 500.0 -341.0 7.0 -7.0 187.0
8452 Gorontalo 2020/11/07 00:00:00+00 3021.0 2327.0 2859.0 2359.0 85.0 78.0 77.0

8453 rows × 9 columns

In [9]:
#rename colomns 
df.rename(columns = {'properties_Provinsi': 'state','properties_Tanggal':'date','properties_Kasus_Terkonfirmasi_Akumulatif': 'Total_Terkonfirmasi', 'properties_Penambahan_Harian_Kasus_Terkonf' : 'Terkonfirmasi_Harian',
                     'properties_Kasus_Sembuh_Akumulatif': 'Total_Sembuh', 'properties_Penambahan_Harian_Kasus_Sembuh': 'Sembuh_Harian', 'properties_Kasus_Meninggal_Akumulatif':'Total_MeninggalDunia','properties_Penambahan_Harian_Kasus_Meningg':'MeninggalDunia_Harian','properties_Kasus_Aktif_Akumulatif':'Total_Aktif' }, inplace=True)
In [10]:
df
Out[10]:
state date Total_Terkonfirmasi Terkonfirmasi_Harian Total_Sembuh Sembuh_Harian Total_MeninggalDunia MeninggalDunia_Harian Total_Aktif
0 Aceh 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0
1 Bali 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0
2 Banten 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0
3 Kepulauan Bangka Belitung 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0
4 Bengkulu 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0
... ... ... ... ... ... ... ... ... ...
8448 Papua Barat 2020/11/07 00:00:00+00 4189.0 326.0 3655.0 389.0 66.0 19.0 468.0
8449 Papua 2020/11/07 00:00:00+00 9037.0 4848.0 4637.0 982.0 129.0 63.0 4271.0
8450 Sulawesi Barat 2020/11/07 00:00:00+00 1036.0 -8001.0 841.0 -3796.0 14.0 -115.0 181.0
8451 Nusa Tenggara Timur 2020/11/07 00:00:00+00 694.0 -342.0 500.0 -341.0 7.0 -7.0 187.0
8452 Gorontalo 2020/11/07 00:00:00+00 3021.0 2327.0 2859.0 2359.0 85.0 78.0 77.0

8453 rows × 9 columns

In [11]:
df.isnull().sum()
Out[11]:
state                    35
date                      0
Total_Terkonfirmasi      35
Terkonfirmasi_Harian     35
Total_Sembuh             35
Sembuh_Harian            35
Total_MeninggalDunia     35
MeninggalDunia_Harian    35
Total_Aktif              35
dtype: int64
In [12]:
df.drop(df[df.state=="Indonesia"].index, inplace=True)
In [13]:
df
Out[13]:
state date Total_Terkonfirmasi Terkonfirmasi_Harian Total_Sembuh Sembuh_Harian Total_MeninggalDunia MeninggalDunia_Harian Total_Aktif
0 Aceh 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0
1 Bali 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0
2 Banten 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0
3 Kepulauan Bangka Belitung 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0
4 Bengkulu 2020/03/02 00:00:00+00 0.0 0.0 0.0 0.0 0.0 0.0 0.0
... ... ... ... ... ... ... ... ... ...
8448 Papua Barat 2020/11/07 00:00:00+00 4189.0 326.0 3655.0 389.0 66.0 19.0 468.0
8449 Papua 2020/11/07 00:00:00+00 9037.0 4848.0 4637.0 982.0 129.0 63.0 4271.0
8450 Sulawesi Barat 2020/11/07 00:00:00+00 1036.0 -8001.0 841.0 -3796.0 14.0 -115.0 181.0
8451 Nusa Tenggara Timur 2020/11/07 00:00:00+00 694.0 -342.0 500.0 -341.0 7.0 -7.0 187.0
8452 Gorontalo 2020/11/07 00:00:00+00 3021.0 2327.0 2859.0 2359.0 85.0 78.0 77.0

8297 rows × 9 columns

Exploratory Data Analysis

In [14]:
temp = df.groupby(['date'])['Total_Terkonfirmasi', 'Total_MeninggalDunia', 'Total_Sembuh', 'Total_Aktif'].sum().reset_index()
temp.style.background_gradient(cmap='Pastel1')
/srv/conda/envs/notebook/lib/python3.7/site-packages/ipykernel_launcher.py:1: FutureWarning: Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.
  """Entry point for launching an IPython kernel.
Out[14]:
date Total_Terkonfirmasi Total_MeninggalDunia Total_Sembuh Total_Aktif
0 1970/01/01 00:00:00+00 0.000000 0.000000 0.000000 0.000000
1 2020/03/02 00:00:00+00 2.000000 0.000000 0.000000 2.000000
2 2020/03/03 00:00:00+00 2.000000 0.000000 0.000000 2.000000
3 2020/03/04 00:00:00+00 2.000000 0.000000 0.000000 2.000000
4 2020/03/05 00:00:00+00 2.000000 0.000000 0.000000 2.000000
5 2020/03/06 00:00:00+00 4.000000 0.000000 0.000000 4.000000
6 2020/03/07 00:00:00+00 4.000000 0.000000 0.000000 4.000000
7 2020/03/08 00:00:00+00 6.000000 0.000000 0.000000 6.000000
8 2020/03/09 00:00:00+00 19.000000 0.000000 0.000000 19.000000
9 2020/03/10 00:00:00+00 27.000000 0.000000 0.000000 27.000000
10 2020/03/11 00:00:00+00 34.000000 1.000000 2.000000 31.000000
11 2020/03/12 00:00:00+00 34.000000 1.000000 2.000000 31.000000
12 2020/03/13 00:00:00+00 69.000000 4.000000 3.000000 62.000000
13 2020/03/14 00:00:00+00 92.000000 5.000000 8.000000 79.000000
14 2020/03/15 00:00:00+00 113.000000 5.000000 8.000000 100.000000
15 2020/03/16 00:00:00+00 130.000000 5.000000 8.000000 117.000000
16 2020/03/17 00:00:00+00 172.000000 5.000000 9.000000 158.000000
17 2020/03/18 00:00:00+00 227.000000 19.000000 11.000000 197.000000
18 2020/03/19 00:00:00+00 309.000000 19.000000 15.000000 275.000000
19 2020/03/20 00:00:00+00 356.000000 32.000000 17.000000 307.000000
20 2020/03/21 00:00:00+00 440.000000 38.000000 20.000000 382.000000
21 2020/03/22 00:00:00+00 508.000000 48.000000 29.000000 431.000000
22 2020/03/23 00:00:00+00 571.000000 49.000000 30.000000 492.000000
23 2020/03/24 00:00:00+00 681.000000 55.000000 30.000000 596.000000
24 2020/03/25 00:00:00+00 778.000000 58.000000 31.000000 689.000000
25 2020/03/26 00:00:00+00 873.000000 78.000000 35.000000 760.000000
26 2020/03/27 00:00:00+00 1018.000000 87.000000 46.000000 885.000000
27 2020/03/28 00:00:00+00 1125.000000 102.000000 59.000000 964.000000
28 2020/03/29 00:00:00+00 1252.000000 114.000000 64.000000 1074.000000
29 2020/03/30 00:00:00+00 1377.000000 122.000000 75.000000 1180.000000
30 2020/03/31 00:00:00+00 1500.000000 136.000000 81.000000 1283.000000
31 2020/04/01 00:00:00+00 1649.000000 157.000000 103.000000 1389.000000
32 2020/04/02 00:00:00+00 1762.000000 170.000000 112.000000 1480.000000
33 2020/04/03 00:00:00+00 1955.000000 181.000000 134.000000 1640.000000
34 2020/04/04 00:00:00+00 2055.000000 191.000000 150.000000 1714.000000
35 2020/04/05 00:00:00+00 2231.000000 198.000000 164.000000 1869.000000
36 2020/04/06 00:00:00+00 2457.000000 209.000000 192.000000 2056.000000
37 2020/04/07 00:00:00+00 2704.000000 221.000000 204.000000 2279.000000
38 2020/04/08 00:00:00+00 2922.000000 240.000000 222.000000 2460.000000
39 2020/04/09 00:00:00+00 3259.000000 280.000000 252.000000 2727.000000
40 2020/04/10 00:00:00+00 3477.000000 306.000000 282.000000 2889.000000
41 2020/04/11 00:00:00+00 3807.000000 327.000000 286.000000 3194.000000
42 2020/04/12 00:00:00+00 4206.000000 373.000000 359.000000 3474.000000
43 2020/04/13 00:00:00+00 4531.000000 399.000000 380.000000 3752.000000
44 2020/04/14 00:00:00+00 4812.000000 459.000000 426.000000 3927.000000
45 2020/04/15 00:00:00+00 5109.000000 469.000000 446.000000 4194.000000
46 2020/04/16 00:00:00+00 5489.000000 496.000000 548.000000 4445.000000
47 2020/04/17 00:00:00+00 5897.000000 520.000000 607.000000 4770.000000
48 2020/04/18 00:00:00+00 6222.000000 535.000000 631.000000 5056.000000
49 2020/04/19 00:00:00+00 6549.000000 582.000000 686.000000 5281.000000
50 2020/04/20 00:00:00+00 6733.000000 590.000000 747.000000 5396.000000
51 2020/04/21 00:00:00+00 7108.000000 616.000000 842.000000 5650.000000
52 2020/04/22 00:00:00+00 7391.000000 636.000000 913.000000 5842.000000
53 2020/04/23 00:00:00+00 7748.000000 647.000000 960.000000 6141.000000
54 2020/04/24 00:00:00+00 8185.000000 689.000000 1002.000000 6494.000000
55 2020/04/25 00:00:00+00 8581.000000 720.000000 1042.000000 6819.000000
56 2020/04/26 00:00:00+00 8856.000000 743.000000 1107.000000 7006.000000
57 2020/04/27 00:00:00+00 9070.000000 765.000000 1151.000000 7154.000000
58 2020/04/28 00:00:00+00 9484.000000 773.000000 1254.000000 7457.000000
59 2020/04/29 00:00:00+00 9744.000000 784.000000 1391.000000 7569.000000
60 2020/04/30 00:00:00+00 10092.000000 792.000000 1522.000000 7778.000000
61 2020/05/01 00:00:00+00 10525.000000 800.000000 1591.000000 8134.000000
62 2020/05/02 00:00:00+00 10819.000000 831.000000 1665.000000 8323.000000
63 2020/05/03 00:00:00+00 11168.000000 845.000000 1876.000000 8447.000000
64 2020/05/04 00:00:00+00 11565.000000 864.000000 1954.000000 8747.000000
65 2020/05/05 00:00:00+00 12049.000000 872.000000 2197.000000 8980.000000
66 2020/05/06 00:00:00+00 12416.000000 895.000000 2317.000000 9204.000000
67 2020/05/07 00:00:00+00 12754.000000 930.000000 2381.000000 9443.000000
68 2020/05/08 00:00:00+00 13091.000000 943.000000 2494.000000 9654.000000
69 2020/05/09 00:00:00+00 13624.000000 959.000000 2604.000000 10061.000000
70 2020/05/10 00:00:00+00 14011.000000 973.000000 2698.000000 10340.000000
71 2020/05/11 00:00:00+00 14244.000000 991.000000 2880.000000 10373.000000
72 2020/05/12 00:00:00+00 14728.000000 1007.000000 3063.000000 10658.000000
73 2020/05/13 00:00:00+00 15417.000000 1028.000000 3287.000000 11102.000000
74 2020/05/14 00:00:00+00 15985.000000 1043.000000 3518.000000 11424.000000
75 2020/05/15 00:00:00+00 16475.000000 1076.000000 3803.000000 11596.000000
76 2020/05/16 00:00:00+00 17004.000000 1089.000000 3911.000000 12004.000000
77 2020/05/17 00:00:00+00 17493.000000 1148.000000 4129.000000 12216.000000
78 2020/05/18 00:00:00+00 17989.000000 1191.000000 4324.000000 12474.000000
79 2020/05/19 00:00:00+00 18475.000000 1221.000000 4467.000000 12787.000000
80 2020/05/20 00:00:00+00 19168.000000 1242.000000 4575.000000 13351.000000
81 2020/05/21 00:00:00+00 20141.000000 1278.000000 4838.000000 14025.000000
82 2020/05/22 00:00:00+00 20775.000000 1326.000000 5057.000000 11596.000000
83 2020/05/23 00:00:00+00 21724.000000 1351.000000 5249.000000 12004.000000
84 2020/05/24 00:00:00+00 22250.000000 1372.000000 5402.000000 12216.000000
85 2020/05/25 00:00:00+00 22729.000000 1391.000000 5642.000000 12474.000000
86 2020/05/26 00:00:00+00 23144.000000 1418.000000 5877.000000 12787.000000
87 2020/05/27 00:00:00+00 23930.000000 1473.000000 6057.000000 16400.000000
88 2020/05/28 00:00:00+00 24517.000000 1496.000000 6240.000000 12787.000000
89 2020/05/29 00:00:00+00 25195.000000 1520.000000 6492.000000 16400.000000
90 2020/05/30 00:00:00+00 25752.000000 1573.000000 7015.000000 17164.000000
91 2020/05/31 00:00:00+00 26452.000000 1613.000000 7308.000000 17531.000000
92 2020/06/01 00:00:00+00 26919.000000 1641.000000 7637.000000 17641.000000
93 2020/06/02 00:00:00+00 27528.000000 1663.000000 7935.000000 17930.000000
94 2020/06/03 00:00:00+00 28212.000000 1698.000000 8406.000000 18108.000000
95 2020/06/04 00:00:00+00 28797.000000 1721.000000 8892.000000 18184.000000
96 2020/06/05 00:00:00+00 29500.000000 1770.000000 9443.000000 18287.000000
97 2020/06/06 00:00:00+00 30493.000000 1801.000000 9907.000000 18785.000000
98 2020/06/07 00:00:00+00 31165.000000 1851.000000 10498.000000 18816.000000
99 2020/06/08 00:00:00+00 32012.000000 1883.000000 10904.000000 19225.000000
100 2020/06/09 00:00:00+00 33055.000000 1923.000000 11414.000000 19718.000000
101 2020/06/10 00:00:00+00 34295.000000 1959.000000 12129.000000 20207.000000
102 2020/06/11 00:00:00+00 35295.000000 2000.000000 12636.000000 20659.000000
103 2020/06/12 00:00:00+00 36406.000000 2048.000000 13213.000000 21145.000000
104 2020/06/13 00:00:00+00 37420.000000 2091.000000 13776.000000 21553.000000
105 2020/06/14 00:00:00+00 38277.000000 2134.000000 14531.000000 21612.000000
106 2020/06/15 00:00:00+00 39294.000000 2198.000000 15123.000000 21973.000000
107 2020/06/16 00:00:00+00 40397.000000 2231.000000 15703.000000 22463.000000
108 2020/06/17 00:00:00+00 41431.000000 2276.000000 16243.000000 22912.000000
109 2020/06/18 00:00:00+00 42762.000000 2339.000000 16798.000000 23625.000000
110 2020/06/19 00:00:00+00 43803.000000 2373.000000 17349.000000 24081.000000
111 2020/06/20 00:00:00+00 45029.000000 2429.000000 17883.000000 24717.000000
112 2020/06/21 00:00:00+00 45891.000000 2465.000000 18404.000000 25022.000000
113 2020/06/22 00:00:00+00 46845.000000 2500.000000 18735.000000 25610.000000
114 2020/06/23 00:00:00+00 47896.000000 2535.000000 19241.000000 26120.000000
115 2020/06/24 00:00:00+00 49009.000000 2573.000000 19638.000000 26798.000000
116 2020/06/25 00:00:00+00 50187.000000 2620.000000 20449.000000 27118.000000
117 2020/06/26 00:00:00+00 51427.000000 2683.000000 21333.000000 27411.000000
118 2020/06/27 00:00:00+00 52811.000000 2720.000000 21909.000000 28182.000000
119 2020/06/28 00:00:00+00 54006.000000 2754.000000 22936.000000 28316.000000
120 2020/06/29 00:00:00+00 55088.000000 2805.000000 23800.000000 28483.000000
121 2020/06/30 00:00:00+00 56381.000000 2876.000000 24806.000000 28699.000000
122 2020/07/01 00:00:00+00 57766.000000 2934.000000 25595.000000 29237.000000
123 2020/07/02 00:00:00+00 59390.000000 2987.000000 26667.000000 29736.000000
124 2020/07/03 00:00:00+00 60691.000000 3036.000000 27568.000000 30087.000000
125 2020/07/04 00:00:00+00 62140.000000 3089.000000 28219.000000 30832.000000
126 2020/07/05 00:00:00+00 63747.000000 3171.000000 29105.000000 31471.000000
127 2020/07/06 00:00:00+00 64956.000000 3241.000000 29919.000000 31796.000000
128 2020/07/07 00:00:00+00 66224.000000 3309.000000 30785.000000 32130.000000
129 2020/07/08 00:00:00+00 68077.000000 3359.000000 31585.000000 33133.000000
130 2020/07/09 00:00:00+00 70734.000000 3417.000000 32651.000000 34666.000000
131 2020/07/10 00:00:00+00 72313.000000 3469.000000 33529.000000 35315.000000
132 2020/07/11 00:00:00+00 73984.000000 3535.000000 34719.000000 35730.000000
133 2020/07/12 00:00:00+00 75665.000000 3606.000000 35638.000000 36421.000000
134 2020/07/13 00:00:00+00 76947.000000 3656.000000 36687.000000 36604.000000
135 2020/07/14 00:00:00+00 78538.000000 3710.000000 37636.000000 37192.000000
136 2020/07/15 00:00:00+00 80060.000000 3797.000000 39050.000000 37213.000000
137 2020/07/16 00:00:00+00 81644.000000 3873.000000 40345.000000 37426.000000
138 2020/07/17 00:00:00+00 83106.000000 3957.000000 41834.000000 37315.000000
139 2020/07/18 00:00:00+00 84854.000000 4016.000000 43243.000000 37595.000000
140 2020/07/19 00:00:00+00 88194.000000 4239.000000 46952.000000 37003.000000
141 2020/07/20 00:00:00+00 88194.000000 4239.000000 46952.000000 37003.000000
142 2020/07/21 00:00:00+00 89851.000000 4320.000000 48441.000000 37090.000000
143 2020/07/22 00:00:00+00 91732.000000 4459.000000 50234.000000 37039.000000
144 2020/07/23 00:00:00+00 93637.000000 4576.000000 52137.000000 36924.000000
145 2020/07/24 00:00:00+00 95395.000000 4665.000000 53918.000000 36812.000000
146 2020/07/25 00:00:00+00 97262.000000 4714.000000 55324.000000 37224.000000
147 2020/07/27 00:00:00+00 98752.000000 4781.000000 56624.000000 37347.000000
148 2020/07/28 00:00:00+00 100274.000000 4838.000000 58142.000000 37294.000000
149 2020/07/30 00:00:00+00 106324.000000 5058.000000 64292.000000 36974.000000
150 2020/07/31 00:00:00+00 108364.000000 5131.000000 65907.000000 37326.000000
151 2020/08/02 00:00:00+00 111443.000000 5236.000000 68975.000000 37232.000000
152 2020/08/03 00:00:00+00 113119.000000 5302.000000 70237.000000 37580.000000
153 2020/08/04 00:00:00+00 115041.000000 5388.000000 72048.000000 37605.000000
154 2020/08/05 00:00:00+00 116855.000000 5452.000000 73880.000000 37523.000000
155 2020/08/06 00:00:00+00 118737.000000 5521.000000 75636.000000 37580.000000
156 2020/08/07 00:00:00+00 121207.000000 5593.000000 77545.000000 38069.000000
157 2020/08/09 00:00:00+00 123494.000000 5658.000000 79291.000000 38545.000000
158 2020/08/10 00:00:00+00 127071.000000 5765.000000 82220.000000 39086.000000
159 2020/08/11 00:00:00+00 128764.000000 5824.000000 83694.000000 39246.000000
160 2020/08/12 00:00:00+00 130706.000000 5903.000000 85776.000000 39027.000000
161 2020/08/14 00:00:00+00 135109.000000 6021.000000 89596.000000 39492.000000
162 2020/08/15 00:00:00+00 135109.000000 6021.000000 89596.000000 39492.000000
163 2020/08/16 00:00:00+00 139528.000000 6150.000000 93080.000000 40298.000000
164 2020/08/17 00:00:00+00 141347.000000 6207.000000 94435.000000 40705.000000
165 2020/08/18 00:00:00+00 143018.000000 6277.000000 96281.000000 40460.000000
166 2020/08/19 00:00:00+00 144917.000000 6346.000000 98629.000000 39942.000000
167 2020/08/20 00:00:00+00 147182.000000 6418.000000 100646.000000 40118.000000
168 2020/08/21 00:00:00+00 149377.000000 6500.000000 102963.000000 39914.000000
169 2020/08/22 00:00:00+00 151463.000000 6594.000000 105170.000000 39699.000000
170 2020/08/23 00:00:00+00 153498.000000 6680.000000 107472.000000 39346.000000
171 2020/08/24 00:00:00+00 155375.000000 6759.000000 111030.000000 37586.000000
172 2020/08/25 00:00:00+00 157819.000000 6858.000000 112832.000000 38129.000000
173 2020/08/26 00:00:00+00 160121.000000 6944.000000 115370.000000 37807.000000
174 2020/08/29 00:00:00+00 169151.000000 7261.000000 122758.000000 39132.000000
175 2020/08/30 00:00:00+00 172005.000000 7343.000000 124141.000000 40521.000000
176 2020/08/31 00:00:00+00 174748.000000 7417.000000 125909.000000 41422.000000
177 2020/09/01 00:00:00+00 177523.000000 7505.000000 128007.000000 42011.000000
178 2020/09/02 00:00:00+00 180598.000000 7616.000000 129920.000000 43062.000000
179 2020/09/03 00:00:00+00 184219.000000 7750.000000 132002.000000 44467.000000
180 2020/09/04 00:00:00+00 187486.000000 7832.000000 134126.000000 45528.000000
181 2020/09/05 00:00:00+00 190614.000000 7940.000000 136343.000000 46331.000000
182 2020/09/06 00:00:00+00 190614.000000 7940.000000 136343.000000 46331.000000
183 2020/09/07 00:00:00+00 196937.000000 8130.000000 140594.000000 48213.000000
184 2020/09/08 00:00:00+00 199976.000000 8230.000000 142896.000000 48850.000000
185 2020/09/10 00:00:00+00 203281.000000 8336.000000 145138.000000 49807.000000
186 2020/09/11 00:00:00+00 203281.000000 8336.000000 145138.000000 49807.000000
187 2020/09/12 00:00:00+00 214662.000000 8649.000000 152394.000000 53619.000000
188 2020/09/13 00:00:00+00 218290.000000 8722.000000 154944.000000 54624.000000
189 2020/09/14 00:00:00+00 221431.000000 8840.000000 158339.000000 54252.000000
190 2020/09/15 00:00:00+00 224937.000000 8964.000000 160994.000000 54979.000000
191 2020/09/16 00:00:00+00 224937.000000 8964.000000 160994.000000 54979.000000
192 2020/09/17 00:00:00+00 232514.000000 9221.000000 166613.000000 56680.000000
193 2020/09/18 00:00:00+00 236404.000000 9334.000000 170698.000000 56372.000000
194 2020/09/19 00:00:00+00 240568.000000 9446.000000 174261.000000 56861.000000
195 2020/09/20 00:00:00+00 244556.000000 9551.000000 177236.000000 57769.000000
196 2020/09/21 00:00:00+00 248731.000000 9675.000000 180702.000000 58354.000000
197 2020/09/22 00:00:00+00 252794.000000 9835.000000 184202.000000 58757.000000
198 2020/09/23 00:00:00+00 257245.000000 9975.000000 187862.000000 59408.000000
199 2020/09/24 00:00:00+00 261878.000000 10103.000000 191752.000000 60023.000000
200 2020/09/25 00:00:00+00 266700.000000 10216.000000 196092.000000 60392.000000
201 2020/09/26 00:00:00+00 271193.000000 10306.000000 199298.000000 61589.000000
202 2020/09/27 00:00:00+00 275067.000000 10384.000000 202896.000000 61787.000000
203 2020/09/28 00:00:00+00 278576.000000 10471.000000 206743.000000 61362.000000
204 2020/09/29 00:00:00+00 282568.000000 10599.000000 210308.000000 61661.000000
205 2020/09/30 00:00:00+00 286838.000000 10738.000000 214817.000000 61283.000000
206 2020/10/01 00:00:00+00 286838.000000 10738.000000 214817.000000 61283.000000
207 2020/10/02 00:00:00+00 295303.000000 10969.000000 221201.000000 63133.000000
208 2020/10/03 00:00:00+00 299291.000000 11052.000000 224909.000000 63330.000000
209 2020/10/04 00:00:00+00 303278.000000 11147.000000 228304.000000 63827.000000
210 2020/10/05 00:00:00+00 306888.000000 11249.000000 232438.000000 63201.000000
211 2020/10/06 00:00:00+00 310939.000000 11370.000000 236280.000000 63289.000000
212 2020/10/07 00:00:00+00 315467.000000 11468.000000 240133.000000 63866.000000
213 2020/10/08 00:00:00+00 320315.000000 11576.000000 243902.000000 64837.000000
214 2020/10/09 00:00:00+00 324395.000000 11673.000000 247507.000000 65215.000000
215 2020/10/10 00:00:00+00 324395.000000 11673.000000 247507.000000 65215.000000
216 2020/10/11 00:00:00+00 333166.000000 11840.000000 254839.000000 66487.000000
217 2020/10/12 00:00:00+00 336433.000000 11931.000000 258329.000000 66173.000000
218 2020/10/13 00:00:00+00 340338.000000 12023.000000 263093.000000 65222.000000
219 2020/10/14 00:00:00+00 344460.000000 12152.000000 267622.000000 64686.000000
220 2020/10/15 00:00:00+00 348867.000000 12264.000000 273422.000000 63181.000000
221 2020/10/16 00:00:00+00 348867.000000 12264.000000 273422.000000 63181.000000
222 2020/10/17 00:00:00+00 357454.000000 12427.000000 281335.000000 63692.000000
223 2020/10/18 00:00:00+00 361543.000000 12506.000000 285061.000000 63976.000000
224 2020/10/19 00:00:00+00 364915.000000 12612.000000 288965.000000 63338.000000
225 2020/10/20 00:00:00+00 368510.000000 12729.000000 293370.000000 62411.000000
226 2020/10/21 00:00:00+00 372762.000000 12852.000000 297221.000000 62689.000000
227 2020/10/22 00:00:00+00 377188.000000 12954.000000 300711.000000 63523.000000
228 2020/10/23 00:00:00+00 381557.000000 13072.000000 304802.000000 63683.000000
229 2020/10/24 00:00:00+00 385622.000000 13200.000000 308919.000000 63503.000000
230 2020/10/25 00:00:00+00 389350.000000 13294.000000 313462.000000 62594.000000
231 2020/10/26 00:00:00+00 392571.000000 13406.000000 317363.000000 61802.000000
232 2020/10/27 00:00:00+00 396079.000000 13507.000000 321926.000000 60646.000000
233 2020/10/28 00:00:00+00 400101.000000 13607.000000 325456.000000 61038.000000
234 2020/10/29 00:00:00+00 403661.000000 13696.000000 329439.000000 60526.000000
235 2020/10/30 00:00:00+00 406555.000000 13777.000000 333956.000000 58822.000000
236 2020/10/31 00:00:00+00 409696.000000 13864.000000 337450.000000 58382.000000
237 2020/11/01 00:00:00+00 412388.000000 13938.000000 341589.000000 56861.000000
238 2020/11/02 00:00:00+00 415001.000000 14039.000000 345206.000000 55756.000000
239 2020/11/03 00:00:00+00 415001.000000 14039.000000 345206.000000 55756.000000
240 2020/11/04 00:00:00+00 415001.000000 14039.000000 345206.000000 55756.000000
241 2020/11/05 00:00:00+00 415001.000000 14039.000000 345206.000000 55756.000000
242 2020/11/06 00:00:00+00 415001.000000 14039.000000 345206.000000 55756.000000
243 2020/11/07 00:00:00+00 415001.000000 14039.000000 345206.000000 55756.000000
In [15]:
temp = df.groupby(['state'])['Total_Terkonfirmasi', 'Total_MeninggalDunia', 'Total_Sembuh', 'Total_Aktif'].sum().reset_index()
temp.style.background_gradient(cmap='Pastel1')
/srv/conda/envs/notebook/lib/python3.7/site-packages/ipykernel_launcher.py:1: FutureWarning: Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.
  """Entry point for launching an IPython kernel.
Out[15]:
state Total_Terkonfirmasi Total_MeninggalDunia Total_Sembuh Total_Aktif
0 Aceh 363328.000000 13221.000000 203140.000000 146970.000000
1 Bali 840525.000000 21196.000000 699945.000000 119363.000000
2 Banten 591995.000000 22592.000000 399141.000000 169638.000000
3 Bengkulu 65722.000000 3814.000000 43274.000000 18648.000000
4 DKI Jakarta 7009226.000000 205506.000000 5321388.000000 1480203.000000
5 Daerah Istimewa Yogyakarta 239848.000000 6527.000000 178686.000000 54737.000000
6 Gorontalo 246373.000000 7059.000000 207130.000000 32018.000000
7 Jambi 63029.000000 1089.000000 30265.000000 31636.000000
8 Jawa Barat 2155747.000000 54290.000000 1286847.000000 812985.000000
9 Jawa Tengah 2246491.000000 132946.000000 1533146.000000 579660.000000
10 Jawa Timur 4560724.000000 334003.000000 3404734.000000 813868.000000
11 Kalimantan Barat 112412.000000 1207.000000 89617.000000 21450.000000
12 Kalimantan Selatan 1100570.000000 48993.000000 784834.000000 265563.000000
13 Kalimantan Tengah 368306.000000 15203.000000 273374.000000 79563.000000
14 Kalimantan Timur 750622.000000 26794.000000 521313.000000 202757.000000
15 Kalimantan Utara 67518.000000 541.000000 53354.000000 13709.000000
16 Kepulauan Bangka Belitung 27645.000000 353.000000 23053.000000 4230.000000
17 Kepulauan Riau 203004.000000 6422.000000 138056.000000 58387.000000
18 Lampung 95430.000000 4147.000000 62611.000000 28548.000000
19 Maluku 286802.000000 4492.000000 188126.000000 93747.000000
20 Maluku Utara 231713.000000 8242.000000 157009.000000 66365.000000
21 Nusa Tenggara Barat 382223.000000 20489.000000 277535.000000 83681.000000
22 Nusa Tenggara Timur 43501.000000 499.000000 28518.000000 14341.000000
23 Papua 661893.000000 8443.000000 364399.000000 288076.000000
24 Papua Barat 203893.000000 3106.000000 140329.000000 60378.000000
25 Riau 621856.000000 13883.000000 394041.000000 213940.000000
26 Sulawesi Barat 68621.000000 1072.000000 47150.000000 20364.000000
27 Sulawesi Selatan 1687873.000000 50092.000000 1226030.000000 410567.000000
28 Sulawesi Tengah 55275.000000 2063.000000 39624.000000 13664.000000
29 Sulawesi Tenggara 280562.000000 5137.000000 191143.000000 84358.000000
30 Sulawesi Utara 473468.000000 20965.000000 324986.000000 126867.000000
31 Sumatera Barat 628993.000000 13861.000000 377669.000000 237574.000000
32 Sumatera Selatan 668595.000000 35226.000000 446052.000000 185967.000000
33 Sumatera Utara 967904.000000 43189.000000 613307.000000 311140.000000
In [16]:
df['date'].max(axis=0)
Out[16]:
'2020/11/07 00:00:00+00'
In [17]:
full_latest = df[df['date'] == max(df['date'])].reset_index() 
full_latest
Out[17]:
index state date Total_Terkonfirmasi Terkonfirmasi_Harian Total_Sembuh Sembuh_Harian Total_MeninggalDunia MeninggalDunia_Harian Total_Aktif
0 8419 Aceh 2020/11/07 00:00:00+00 7457.0 4436.0 5173.0 2314.0 270.0 185.0 2014.0
1 8420 Bali 2020/11/07 00:00:00+00 11846.0 4389.0 10766.0 5593.0 391.0 121.0 689.0
2 8421 Banten 2020/11/07 00:00:00+00 9654.0 -2192.0 7578.0 -3188.0 275.0 -116.0 1801.0
3 8422 Kepulauan Bangka Belitung 2020/11/07 00:00:00+00 191.0 -9463.0 173.0 -7405.0 2.0 -273.0 16.0
4 8423 Bengkulu 2020/11/07 00:00:00+00 1087.0 896.0 833.0 660.0 52.0 50.0 202.0
5 8424 Daerah Istimewa Yogyakarta 2020/11/07 00:00:00+00 3883.0 2796.0 3209.0 2376.0 94.0 42.0 580.0
6 8425 DKI Jakarta 2020/11/07 00:00:00+00 107229.0 103346.0 95783.0 92574.0 2288.0 2194.0 9158.0
7 8426 Jambi 2020/11/07 00:00:00+00 1230.0 -105999.0 619.0 -95164.0 23.0 -2265.0 588.0
8 8427 Jawa Barat 2020/11/07 00:00:00+00 36924.0 35694.0 26671.0 26052.0 732.0 709.0 9521.0
9 8428 Jawa Tengah 2020/11/07 00:00:00+00 34618.0 -2306.0 28788.0 2117.0 1766.0 1034.0 4064.0
10 8429 Jawa Timur 2020/11/07 00:00:00+00 53002.0 18384.0 47001.0 18213.0 3799.0 2033.0 2202.0
11 8430 Kalimantan Barat 2020/11/07 00:00:00+00 1677.0 -51325.0 1338.0 -45663.0 21.0 -3778.0 318.0
12 8431 Kalimantan Timur 2020/11/07 00:00:00+00 14345.0 12668.0 11500.0 10162.0 489.0 468.0 2356.0
13 8432 Kalimantan Tengah 2020/11/07 00:00:00+00 4381.0 -9964.0 3906.0 -7594.0 153.0 -336.0 322.0
14 8433 Kalimantan Selatan 2020/11/07 00:00:00+00 11893.0 7512.0 10873.0 6967.0 487.0 334.0 533.0
15 8434 Kalimantan Utara 2020/11/07 00:00:00+00 829.0 -11064.0 722.0 -10151.0 8.0 -479.0 99.0
16 8435 Kepulauan Riau 2020/11/07 00:00:00+00 4047.0 3218.0 2775.0 2053.0 94.0 86.0 1178.0
17 8436 Nusa Tenggara Barat 2020/11/07 00:00:00+00 3998.0 -49.0 3272.0 497.0 222.0 128.0 504.0
18 8437 Sumatera Selatan 2020/11/07 00:00:00+00 7921.0 3923.0 6394.0 3122.0 428.0 206.0 1099.0
19 8438 Sumatera Barat 2020/11/07 00:00:00+00 14940.0 7019.0 10764.0 4370.0 270.0 -158.0 3906.0
20 8439 Sulawesi Utara 2020/11/07 00:00:00+00 5452.0 -9488.0 4585.0 -6179.0 205.0 -65.0 662.0
21 8440 Sumatera Utara 2020/11/07 00:00:00+00 13277.0 7825.0 10846.0 6261.0 542.0 337.0 1889.0
22 8441 Sulawesi Tenggara 2020/11/07 00:00:00+00 5073.0 -8204.0 4034.0 -6812.0 83.0 -459.0 956.0
23 8442 Sulawesi Selatan 2020/11/07 00:00:00+00 18372.0 13299.0 16617.0 12583.0 468.0 385.0 1287.0
24 8443 Sulawesi Tengah 2020/11/07 00:00:00+00 878.0 -17494.0 672.0 -15945.0 36.0 -432.0 170.0
25 8444 Lampung 2020/11/07 00:00:00+00 1884.0 1006.0 1120.0 448.0 78.0 42.0 686.0
26 8445 Riau 2020/11/07 00:00:00+00 14841.0 12957.0 11490.0 10370.0 340.0 262.0 3011.0
27 8446 Maluku Utara 2020/11/07 00:00:00+00 2232.0 -12609.0 1946.0 -9544.0 75.0 -265.0 211.0
28 8447 Maluku 2020/11/07 00:00:00+00 3863.0 1631.0 3266.0 1320.0 47.0 -28.0 550.0
29 8448 Papua Barat 2020/11/07 00:00:00+00 4189.0 326.0 3655.0 389.0 66.0 19.0 468.0
30 8449 Papua 2020/11/07 00:00:00+00 9037.0 4848.0 4637.0 982.0 129.0 63.0 4271.0
31 8450 Sulawesi Barat 2020/11/07 00:00:00+00 1036.0 -8001.0 841.0 -3796.0 14.0 -115.0 181.0
32 8451 Nusa Tenggara Timur 2020/11/07 00:00:00+00 694.0 -342.0 500.0 -341.0 7.0 -7.0 187.0
33 8452 Gorontalo 2020/11/07 00:00:00+00 3021.0 2327.0 2859.0 2359.0 85.0 78.0 77.0
In [18]:
Total_Terkonfirmasi_fix = full_latest['Total_Terkonfirmasi'].sum()
Total_Terkonfirmasi_fix
Out[18]:
415001.0
In [19]:
Total_Sembuh_fix = full_latest['Total_Sembuh'].sum()
Total_Sembuh_fix
Out[19]:
345206.0
In [20]:
Total_MeninggalDunia_fix = full_latest['Total_MeninggalDunia'].sum()
Total_MeninggalDunia_fix
Out[20]:
14039.0

Top10 Confimed Case

In [21]:
Top10kasus_terkonfirmasi = full_latest.sort_values(by='Total_Terkonfirmasi', ascending=False).head(10)
Top10kasus_terkonfirmasi
Out[21]:
index state date Total_Terkonfirmasi Terkonfirmasi_Harian Total_Sembuh Sembuh_Harian Total_MeninggalDunia MeninggalDunia_Harian Total_Aktif
6 8425 DKI Jakarta 2020/11/07 00:00:00+00 107229.0 103346.0 95783.0 92574.0 2288.0 2194.0 9158.0
10 8429 Jawa Timur 2020/11/07 00:00:00+00 53002.0 18384.0 47001.0 18213.0 3799.0 2033.0 2202.0
8 8427 Jawa Barat 2020/11/07 00:00:00+00 36924.0 35694.0 26671.0 26052.0 732.0 709.0 9521.0
9 8428 Jawa Tengah 2020/11/07 00:00:00+00 34618.0 -2306.0 28788.0 2117.0 1766.0 1034.0 4064.0
23 8442 Sulawesi Selatan 2020/11/07 00:00:00+00 18372.0 13299.0 16617.0 12583.0 468.0 385.0 1287.0
19 8438 Sumatera Barat 2020/11/07 00:00:00+00 14940.0 7019.0 10764.0 4370.0 270.0 -158.0 3906.0
26 8445 Riau 2020/11/07 00:00:00+00 14841.0 12957.0 11490.0 10370.0 340.0 262.0 3011.0
12 8431 Kalimantan Timur 2020/11/07 00:00:00+00 14345.0 12668.0 11500.0 10162.0 489.0 468.0 2356.0
21 8440 Sumatera Utara 2020/11/07 00:00:00+00 13277.0 7825.0 10846.0 6261.0 542.0 337.0 1889.0
14 8433 Kalimantan Selatan 2020/11/07 00:00:00+00 11893.0 7512.0 10873.0 6967.0 487.0 334.0 533.0
In [22]:
Top10kasus_sembuh = full_latest.sort_values(by='Total_Sembuh', ascending=False).head(10)
Top10kasus_sembuh
Out[22]:
index state date Total_Terkonfirmasi Terkonfirmasi_Harian Total_Sembuh Sembuh_Harian Total_MeninggalDunia MeninggalDunia_Harian Total_Aktif
6 8425 DKI Jakarta 2020/11/07 00:00:00+00 107229.0 103346.0 95783.0 92574.0 2288.0 2194.0 9158.0
10 8429 Jawa Timur 2020/11/07 00:00:00+00 53002.0 18384.0 47001.0 18213.0 3799.0 2033.0 2202.0
9 8428 Jawa Tengah 2020/11/07 00:00:00+00 34618.0 -2306.0 28788.0 2117.0 1766.0 1034.0 4064.0
8 8427 Jawa Barat 2020/11/07 00:00:00+00 36924.0 35694.0 26671.0 26052.0 732.0 709.0 9521.0
23 8442 Sulawesi Selatan 2020/11/07 00:00:00+00 18372.0 13299.0 16617.0 12583.0 468.0 385.0 1287.0
12 8431 Kalimantan Timur 2020/11/07 00:00:00+00 14345.0 12668.0 11500.0 10162.0 489.0 468.0 2356.0
26 8445 Riau 2020/11/07 00:00:00+00 14841.0 12957.0 11490.0 10370.0 340.0 262.0 3011.0
14 8433 Kalimantan Selatan 2020/11/07 00:00:00+00 11893.0 7512.0 10873.0 6967.0 487.0 334.0 533.0
21 8440 Sumatera Utara 2020/11/07 00:00:00+00 13277.0 7825.0 10846.0 6261.0 542.0 337.0 1889.0
1 8420 Bali 2020/11/07 00:00:00+00 11846.0 4389.0 10766.0 5593.0 391.0 121.0 689.0
In [23]:
Top10kasus_meninggaldunia = full_latest.sort_values(by='Total_MeninggalDunia', ascending=False).head(10)
Top10kasus_meninggaldunia
Out[23]:
index state date Total_Terkonfirmasi Terkonfirmasi_Harian Total_Sembuh Sembuh_Harian Total_MeninggalDunia MeninggalDunia_Harian Total_Aktif
10 8429 Jawa Timur 2020/11/07 00:00:00+00 53002.0 18384.0 47001.0 18213.0 3799.0 2033.0 2202.0
6 8425 DKI Jakarta 2020/11/07 00:00:00+00 107229.0 103346.0 95783.0 92574.0 2288.0 2194.0 9158.0
9 8428 Jawa Tengah 2020/11/07 00:00:00+00 34618.0 -2306.0 28788.0 2117.0 1766.0 1034.0 4064.0
8 8427 Jawa Barat 2020/11/07 00:00:00+00 36924.0 35694.0 26671.0 26052.0 732.0 709.0 9521.0
21 8440 Sumatera Utara 2020/11/07 00:00:00+00 13277.0 7825.0 10846.0 6261.0 542.0 337.0 1889.0
12 8431 Kalimantan Timur 2020/11/07 00:00:00+00 14345.0 12668.0 11500.0 10162.0 489.0 468.0 2356.0
14 8433 Kalimantan Selatan 2020/11/07 00:00:00+00 11893.0 7512.0 10873.0 6967.0 487.0 334.0 533.0
23 8442 Sulawesi Selatan 2020/11/07 00:00:00+00 18372.0 13299.0 16617.0 12583.0 468.0 385.0 1287.0
18 8437 Sumatera Selatan 2020/11/07 00:00:00+00 7921.0 3923.0 6394.0 3122.0 428.0 206.0 1099.0
1 8420 Bali 2020/11/07 00:00:00+00 11846.0 4389.0 10766.0 5593.0 391.0 121.0 689.0
In [24]:
Top10kasus_aktif = full_latest.sort_values(by='Total_Aktif', ascending=False).head(10)
Top10kasus_aktif
Out[24]:
index state date Total_Terkonfirmasi Terkonfirmasi_Harian Total_Sembuh Sembuh_Harian Total_MeninggalDunia MeninggalDunia_Harian Total_Aktif
8 8427 Jawa Barat 2020/11/07 00:00:00+00 36924.0 35694.0 26671.0 26052.0 732.0 709.0 9521.0
6 8425 DKI Jakarta 2020/11/07 00:00:00+00 107229.0 103346.0 95783.0 92574.0 2288.0 2194.0 9158.0
30 8449 Papua 2020/11/07 00:00:00+00 9037.0 4848.0 4637.0 982.0 129.0 63.0 4271.0
9 8428 Jawa Tengah 2020/11/07 00:00:00+00 34618.0 -2306.0 28788.0 2117.0 1766.0 1034.0 4064.0
19 8438 Sumatera Barat 2020/11/07 00:00:00+00 14940.0 7019.0 10764.0 4370.0 270.0 -158.0 3906.0
26 8445 Riau 2020/11/07 00:00:00+00 14841.0 12957.0 11490.0 10370.0 340.0 262.0 3011.0
12 8431 Kalimantan Timur 2020/11/07 00:00:00+00 14345.0 12668.0 11500.0 10162.0 489.0 468.0 2356.0
10 8429 Jawa Timur 2020/11/07 00:00:00+00 53002.0 18384.0 47001.0 18213.0 3799.0 2033.0 2202.0
0 8419 Aceh 2020/11/07 00:00:00+00 7457.0 4436.0 5173.0 2314.0 270.0 185.0 2014.0
21 8440 Sumatera Utara 2020/11/07 00:00:00+00 13277.0 7825.0 10846.0 6261.0 542.0 337.0 1889.0

Visualization Using Heat Maps

In [25]:
fig = px.choropleth(df, geojson='https://raw.githubusercontent.com/superpikar/indonesia-geojson/master/indonesia.geojson', locations='state', color='Total_Terkonfirmasi', color_continuous_scale='Reds', featureidkey='properties.state', animation_frame='date', range_color=(0, max(df['Total_Terkonfirmasi'])))
fig.update_layout(margin={"r": 0, "t": 0, "l": 0, "b": 0})
fig.update_geos(fitbounds="locations", visible=False)
fig.show()
In [26]:
fig = px.choropleth(df, geojson='https://raw.githubusercontent.com/superpikar/indonesia-geojson/master/indonesia.geojson', locations='state', color='Total_Sembuh', color_continuous_scale='Reds', featureidkey='properties.state', animation_frame='date', range_color=(0, max(df['Total_Terkonfirmasi'])))
fig.update_layout(margin={"r": 0, "t": 0, "l": 0, "b": 0})
fig.update_geos(fitbounds="locations", visible=False)
fig.show()
In [27]:
fig = px.choropleth(df, geojson='https://raw.githubusercontent.com/superpikar/indonesia-geojson/master/indonesia.geojson', locations='state', color='Total_MeninggalDunia', color_continuous_scale='Reds', featureidkey='properties.state', animation_frame='date', range_color=(0, max(df['Total_Terkonfirmasi'])))
fig.update_layout(margin={"r": 0, "t": 0, "l": 0, "b": 0})
fig.update_geos(fitbounds="locations", visible=False)
fig.show()
In [28]:
fig = px.choropleth(df, geojson='https://raw.githubusercontent.com/superpikar/indonesia-geojson/master/indonesia.geojson', locations='state', color='Total_Aktif', color_continuous_scale='Reds', featureidkey='properties.state', animation_frame='date', range_color=(0, max(df['Total_Terkonfirmasi'])))
fig.update_layout(margin={"r": 0, "t": 0, "l": 0, "b": 0})
fig.update_geos(fitbounds="locations", visible=False)
fig.show()
In [ ]:
 

Visualization Using Bar Chart

In [29]:
fig1 = px.bar(Top10kasus_terkonfirmasi, x=Top10kasus_terkonfirmasi['state'], y=Top10kasus_terkonfirmasi['Total_Terkonfirmasi'],
              hover_name=Top10kasus_terkonfirmasi['state'],
              color=Top10kasus_terkonfirmasi['Total_Terkonfirmasi'], text=Top10kasus_terkonfirmasi['Total_Terkonfirmasi'], height=400)
fig1.update_traces(texttemplate='%{text:}', textposition='outside')
fig1.update_layout(
    title={
        'text': "Provinsi dengan kasus terkonfirmasi tertinggi di Indonesia",
        'y':1,
        'x':0.5,
        'xanchor': 'center',
        'yanchor': 'top'})
    # Set the visibility ON
fig1.update_xaxes(title='Provinsi', visible=True, showticklabels=True)
# Set the visibility OFF
fig1.update_yaxes(title='Total', visible=True, showticklabels=True)

fig1.show()
In [30]:
fig11 = px.bar(Top10kasus_sembuh, x=Top10kasus_sembuh['state'], y=Top10kasus_sembuh['Total_Sembuh'],
              hover_name=Top10kasus_sembuh['state'],
              color=Top10kasus_sembuh['Total_Sembuh'], text=Top10kasus_sembuh['Total_Sembuh'], height=400)
fig11.update_traces(texttemplate='%{text:}', textposition='outside')
fig11.update_layout(
    title={
        'text': "Provinsi dengan kasus sembuh tertinggi di Indonesia",
        'y':1,
        'x':0.5,
        'xanchor': 'center',
        'yanchor': 'top'})
    # Set the visibility ON
fig11.update_xaxes(title='Provinsi', visible=True, showticklabels=True)
# Set the visibility OFF
fig11.update_yaxes(title='Total', visible=True, showticklabels=True)

fig11.show()
In [54]:
fig12 = px.bar(Top10kasus_meninggaldunia, x=Top10kasus_meninggaldunia['state'], y=Top10kasus_meninggaldunia['Total_MeninggalDunia'],
              hover_name=Top10kasus_meninggaldunia['state'],
              color=Top10kasus_meninggaldunia['Total_MeninggalDunia'], text=Top10kasus_meninggaldunia['Total_MeninggalDunia'], height=400)
fig12.update_traces(texttemplate='%{text:}', textposition='outside')
fig12.update_layout(
    title={
        'text': "Provinsi dengan kasus Sembuh tertinggi di Indonesia",
        'y':1,
        'x':0.5,
        'xanchor': 'center',
        'yanchor': 'top'})
    # Set the visibility ON
fig12.update_xaxes(title='Provinsi', visible=True, showticklabels=True)
# Set the visibility OFF
fig12.update_yaxes(title='Total', visible=True, showticklabels=True)

fig12.show()
In [55]:
fig13 = px.bar(Top10kasus_aktif, x=Top10kasus_aktif['state'], y=Top10kasus_aktif['Total_Aktif'],
              hover_name=Top10kasus_aktif['state'],
              color=Top10kasus_aktif['Total_Aktif'], text=Top10kasus_aktif['Total_Aktif'], height=400)
fig13.update_traces(texttemplate='%{text:}', textposition='outside')
fig13.update_layout(
    title={
        'text': "Provinsi dengan kasus Aktif tertinggi di Indonesia",
        'y':1,
        'x':0.5,
        'xanchor': 'center',
        'yanchor': 'top'})
    # Set the visibility ON
fig13.update_xaxes(title='Provinsi', visible=True, showticklabels=True)
# Set the visibility OFF
fig13.update_yaxes(title='Total', visible=True, showticklabels=True)

fig13.show()

Visualization Using Pie Chart

In [33]:
fig2 = go.Figure(data=[go.Pie(labels=Top10kasus_terkonfirmasi['state'], values=Top10kasus_terkonfirmasi['Total_Terkonfirmasi'],
                               insidetextorientation='radial',
                               pull=[0.1, 0, 0, 0, 0, 0])])
fig2.update_traces(textinfo='percent+label')

fig2.show()
In [34]:
fig21 = go.Figure(data=[go.Pie(labels=Top10kasus_sembuh['state'], values=Top10kasus_sembuh['Total_Sembuh'],
                               insidetextorientation='radial',
                               pull=[0.1, 0, 0, 0, 0, 0])])
fig21.update_traces(textinfo='percent+label')

fig21.show()
In [35]:
fig22 = go.Figure(data=[go.Pie(labels=Top10kasus_meninggaldunia['state'], values=Top10kasus_meninggaldunia['Total_MeninggalDunia'],
                               insidetextorientation='radial',
                               pull=[0.1, 0, 0, 0, 0, 0])])
fig22.update_traces(textinfo='percent+label')

fig22.show()
In [36]:
fig23 = go.Figure(data=[go.Pie(labels=Top10kasus_aktif['state'], values=Top10kasus_meninggaldunia['Total_Aktif'],
                               insidetextorientation='radial',
                               pull=[0.1, 0, 0, 0, 0, 0])])
fig23.update_traces(textinfo='percent+label')

fig23.show()

Visualization Using Bubble Chart

In [37]:
Top10kasus_terkonfirmasi['Tingkat_Penyembuhan'] = Top10kasus_terkonfirmasi['Total_Sembuh'] / Top10kasus_terkonfirmasi['Total_Terkonfirmasi']
Top10kasus_terkonfirmasi['Tingkat_Hidup'] = Top10kasus_terkonfirmasi['Total_MeninggalDunia'] / Top10kasus_terkonfirmasi['Total_Terkonfirmasi']
Top10kasus_terkonfirmasi.index = Top10kasus_terkonfirmasi.index

fig3 = px.scatter(Top10kasus_terkonfirmasi, x='Tingkat_Penyembuhan', y='Tingkat_Hidup',
                  color='state', size='Total_Terkonfirmasi', hover_name='state',
                  size_max=30)
fig3.show()

Visualization Using Tree Maps

In [57]:
fig4 = px.treemap(Top10kasus_terkonfirmasi.sort_values(by='Total_Terkonfirmasi', ascending=False).reset_index(drop=True), 
                 path=["state"], values="Total_Terkonfirmasi", height=700,
                 title='Tree Maps Total Terkonfirmasi',
                 color_discrete_sequence = px.colors.qualitative.Prism)
fig4.data[0].textinfo = 'label+text+value'
fig4.update_layout(margin=dict(t=80,l=0,r=0,b=0))
fig4.show()
In [58]:
fig41 = px.treemap(Top10kasus_sembuh.sort_values(by='Total_Terkonfirmasi', ascending=False).reset_index(drop=True), 
                 path=["state"], values="Total_Sembuh", height=700,
                 title='Tree Maps Total Sembuh',
                 color_discrete_sequence = px.colors.qualitative.Prism)
fig41.data[0].textinfo = 'label+text+value'
fig41.update_layout(margin=dict(t=80,l=0,r=0,b=0))
fig41.show()
In [59]:
fig42 = px.treemap(Top10kasus_meninggaldunia.sort_values(by='Total_MeninggalDunia', ascending=False).reset_index(drop=True), 
                 path=["state"], values="Total_MeninggalDunia", height=700,
                 title='Tree Maps Total Meninggal Dunia',
                 color_discrete_sequence = px.colors.qualitative.Prism)
fig42.data[0].textinfo = 'label+text+value'
fig42.update_layout(margin=dict(t=80,l=0,r=0,b=0))
fig42.show()
In [60]:
fig43 = px.treemap(Top10kasus_sembuh.sort_values(by='Total_Sembuh', ascending=False).reset_index(drop=True), 
                 path=["state"], values="Total_Sembuh", height=700,
                 title='Tree Maps Total Sembuh',
                 color_discrete_sequence = px.colors.qualitative.Prism)
fig43.data[0].textinfo = 'label+text+value'
fig43.update_layout(margin=dict(t=80,l=0,r=0,b=0))
fig43.show()
In [61]:
fig44 = px.treemap(Top10kasus_aktif.sort_values(by='Total_Aktif', ascending=False).reset_index(drop=True), 
                 path=["state"], values="Total_Aktif", height=700,
                 title='Tree Maps Total Aktif',
                 color_discrete_sequence = px.colors.qualitative.Prism)
fig44.data[0].textinfo = 'label+text+value'
fig44.update_layout(margin=dict(t=80,l=0,r=0,b=0))
fig44.show()

Interactive Visualization Using Line Chart

In [43]:
temp = df.groupby('date').sum().reset_index()

temp['Jumlah Kematian dari 100 Kasus yang Terkonfirmasi'] = round(temp['Total_MeninggalDunia']/temp['Total_Terkonfirmasi'], 3)*100
temp['Jumlah Sembuh dari 100 Kasus yang Terkonfirmasi'] = round(temp['Total_Sembuh']/temp['Total_Terkonfirmasi'], 3)*100

temp = temp.melt(id_vars='date', value_vars=['Jumlah Kematian dari 100 Kasus yang Terkonfirmasi', 'Jumlah Sembuh dari 100 Kasus yang Terkonfirmasi'], 
                 var_name='Ratio', value_name='Value')

fig5 = px.line(temp, x="date", y="Value", color='Ratio', log_y=True, 
              title='Tingkat Kesembuhan dan Kematian berdasarkan 100 Kasus yang Terkonfirmasi',
              color_discrete_sequence=px.colors.qualitative.G10)
fig5.update_layout(legend=dict(orientation="h", y=1, x=0, 
                              xanchor="left", yanchor="top"),
                  margin=dict(t=80,l=0,r=0,b=0))
fig5.show()
In [44]:
fig6 = go.Figure(go.Line(x=df['date'], y=df['Total_Terkonfirmasi'],name='Terkonfirmasi', mode='lines+markers',marker=dict(size=10,color='indianred')))
fig6.add_trace(go.Line(x=df['date'], y=df['Total_Sembuh'],name='Sembuh', mode='lines+markers',marker=dict(size=10,color='lightseagreen')))
fig6.add_trace(go.Line(x=df['date'], y=df['Total_MeninggalDunia'], name='Meninggal Dunia', mode='lines+markers',marker=dict(size=10,color='gray')))
fig6.add_trace(go.Line(x=df['date'], y=df['Total_Aktif'], name='Aktif', mode='lines+markers',marker=dict(size=10,color='Orange')))

fig6.update_layout(xaxis_showgrid=True, yaxis_showgrid=True, plot_bgcolor='whitesmoke', 
        title={
        'text': 'Line Chart Kasus Covid-19 di Indonesia',
        'y':0.75,
        'x':0.5,
        'xanchor': 'center',
        'yanchor': 'top'},xaxis_type='category')
fig6.update_xaxes(title= '------>Timeline' ,showline=False)
fig6.update_yaxes(title= '------>jumlah kasus', showline=False)

fig6.show()
/srv/conda/envs/notebook/lib/python3.7/site-packages/plotly/graph_objs/_deprecations.py:385: DeprecationWarning:

plotly.graph_objs.Line is deprecated.
Please replace it with one of the following more specific types
  - plotly.graph_objs.scatter.Line
  - plotly.graph_objs.layout.shape.Line
  - etc.


Interactive Visualization Using Scatter Plot

In [45]:
fig7 = px.scatter(Top10kasus_terkonfirmasi, x='state', y='Total_Terkonfirmasi')
fig7.show()
In [46]:
fig71 = px.scatter(Top10kasus_meninggaldunia, x='state', y='Total_MeninggalDunia')
fig71.show()
In [47]:
fig72 = px.scatter(Top10kasus_sembuh, x='state', y='Total_Sembuh')
fig72.show()
In [48]:
fig73 = px.scatter(Top10kasus_aktif, x='state', y='Total_Aktif')
fig73.show()

Simple Dashboard

In [49]:
fig = make_subplots(
 rows = 4, cols = 6,
 specs=[
 [{'type': 'scattergeo', 'rowspan': 4, 'colspan': 3}, None, None, {'type': 'indicator'}, {'type': 'indicator'}, {'type': 'indicator'} ],
 [ None, None, None, {'type': 'bar', 'colspan':3}, None, None],
 [ None, None, None, {'type':'bar', 'colspan':3}, None, None],
 [ None, None, None, {'type': 'bar', 'colspan':3}, None, None],
 ]
)
In [50]:
full_latest['text'] = full_latest['state'] 
full_latest['text'] += 'Total Terkonfirmasi : ' + full_latest['Total_Terkonfirmasi'].astype(str) + "\n"
full_latest['text'] += 'Total Sembuh : ' + full_latest['Total_Sembuh'].astype(str) + "\n"
full_latest['text'] += 'Total MeninggalDunia : ' + full_latest['Total_MeninggalDunia'].astype(str) + "\n"
full_latest['text'] += 'Total Aktif : ' + full_latest['Total_Aktif'].astype(str) + "\n"
In [51]:
fig.add_trace(
 go.Scattergeo(
 geojson='https://raw.githubusercontent.com/superpikar/indonesia-geojson/master/indonesia.geojson', 
 featureidkey='properties.state',
 locations=full_latest['state'],
 hovertext = full_latest['text'],
 showlegend=False,
 marker = dict(
 size = 10,
 opacity = 0.8,
 reversescale = True,
 autocolorscale = True,
 symbol = 'square',
 line = dict(
 width=1,
 
 ),
 color=full_latest['Total_Terkonfirmasi'], 
 colorbar_title="Terkonfirmasi", 
 colorbar_x = -0.05,
 )),
 
 row=1, col=1
)
fig.update_layout(
    geo_scope='asia',
    height=600)
fig.update_geos(fitbounds="locations")
In [52]:
fig.add_trace(
 go.Indicator(
 mode='number',
 value=Total_Terkonfirmasi_fix,
 title='Total terkonfirmasi',
 ),
 row=1, col=4
)
fig.add_trace(
 go.Indicator(
 mode='number',
 value=Total_Sembuh_fix,
 title='Total sembuh',
 ),
 row=1, col=5
)
fig.add_trace(
 go.Indicator(
 mode='number',
 value=Total_MeninggalDunia_fix,
 title='Total meninggal',
 ),
 row=1, col=6
)
In [53]:
fig.add_trace(
 go.Bar(
 x=Top10kasus_terkonfirmasi['state'],
 y=Top10kasus_terkonfirmasi['Total_Terkonfirmasi'], 
 name= 'Terkonfirmasi',
 marker=dict(color='Yellow'), 
 showlegend=True,
 ),
 row=2, col=4
)
fig.add_trace(
 go.Bar(
 x=Top10kasus_sembuh['state'],
 y=Top10kasus_sembuh['Total_Sembuh'], 
 name= 'Sembuh',
 marker=dict(color='Blue'), 
 showlegend=True),
 row=3, col=4
)
fig.add_trace(
 go.Bar(
 x=Top10kasus_meninggaldunia['state'],
 y=Top10kasus_meninggaldunia['Total_MeninggalDunia'], 
 name= 'Meninggal',
 marker=dict(color='Green'), 
 showlegend=True),
 row=4, col=4
)
                                             Nadya Safitri